#pragma once
#include <string>
#include <map>

namespace mdx{

struct Param{

	void Clear();

	void Erase(const std::string& name);
	
	template<typename Type>
	void Put(const std::string& name, Type value);

	template<typename Type>
	Type& Get(const std::string& name)const;

	bool Find(const std::string& name)const;

private:

	std::map<std::string, void*> m_params;

};

template<typename Type>
Type& mdx::Param::Get(const std::string& name) const
{
	return *(reinterpret_cast<Type*>(m_params[name]));
}

template<typename Type>
void mdx::Param::Put(const std::string& name, Type value)
{
	m_params[name] = reinterpret_cast<void*>(&value);
}

void Param::Clear()
{
	m_params.clear();
}

void Param::Erase(const std::string& name)
{
	m_params.erase(name);
}

bool Param::Find(const std::string& name) const
{
	return m_params.find(name) != m_params.end();
}

}